-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RISC-V] Test TotalOrderIeee754ComparerTests: Fix NFloat - NaN testcases for RISC-V #97340
[RISC-V] Test TotalOrderIeee754ComparerTests: Fix NFloat - NaN testcases for RISC-V #97340
Conversation
Tagging subscribers to this area: @dotnet/area-system-numerics Issue Detailsfloat->double cast instruction produced by NFloat constructor does not preserve NaN sign and payload on RISC-V. Part of #84834
|
@dotnet-policy-service agree company="Samsung" |
if (PlatformDetection.IsRiscV64Process) // float->double cast does not preserve NaN payload and sign on RISC-V | ||
{ | ||
yield return new object[] { BitConverter.UInt32BitsToSingle(0xFFC00000), float.NegativeInfinity, 1 }; | ||
yield return new object[] { BitConverter.UInt32BitsToSingle(0xFFC00000), -1.0f, 1 }; | ||
yield return new object[] { BitConverter.UInt32BitsToSingle(0xFFC00000), BitConverter.UInt32BitsToSingle(0x7FC00000), 0 }; | ||
yield return new object[] { BitConverter.UInt32BitsToSingle(0x7FC00000), BitConverter.UInt32BitsToSingle(0x7FC00001), 0 }; // implementation defined, not part of IEEE 754 totalOrder | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the desirable/best fix.
The overall preservation of a NaN
sign/payload is implementation defined; however, in the face of a NaN
with sign and/or payload, IEEE 754 totalOrder
describes exact handling/behavior that is required to be followed.
The test was using SingleTestData
for simplicity purposes; however in the face of RiscV
it is likely better to fix the test to take NFloat
and to enumerate bitwise correct values depending on the underlying bitness of the platform. That way encountered NaN
with sign/payload (such as from the developer doing a bitcast where RiscV doesn't normalize) can be validated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to enumerate bitwise correct values only for NaN values or for all test values?
.../System.Runtime/tests/System.Runtime.Tests/System/Numerics/TotalOrderIeee754ComparerTests.cs
Outdated
Show resolved
Hide resolved
Looks like there are some CI failures related to this PR that need to be resolved still, specifically related to Failures look to be similar to |
Thank you for noticing, I have fixed this failure. |
@tannergooding, thank you for merge it! |
float->double cast instruction produced by NFloat constructor does not preserve NaN sign and payload on RISC-V.
That's why all NaN values in test data are same positive NaNs without payload.
Part of #84834
cc @tannergooding @gbalykov @t-mustafin @clamp03 @tomeksowi